<template>
    <div class="goods-info" @click="detail">
        <div class="goods-image">
            <img v-lazy="goodsImage" width="90%" />
        </div>
        <div class="goods-name">{{goodsName}}</div>
        <div class="goods-price">￥{{goodsPrice | moneyFilter }}</div>
    </div>
</template>

<script>
    import {toMoney} from '@/components/js/filter/moneyFilter.js'
    export default {
        props: ['goodsName', 'goodsPrice', 'goodsImage', 'goodsId'],
        filters: {
            moneyFilter (money) {
                return toMoney(money)
            }
        },
        methods: {
            detail() {
                this.$router.push({name:'Goods', query: {goodsId: this.goodsId}})
            }
        },
    }
</script>

<style scoped>
    .goods-name{
        padding: 0 8px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space:nowrap; 
    }
</style>